<!-- 全局js -->
<script src="__AJS__/jquery-2.1.1.min.js"></script>
<script src="__AJS__/bootstrap.min.js?v=3.4.0"></script>
<!-- 弹出层插件js -->
<script src="__AJSPLUGINS__/layer/layer.min.js"></script>
<!-- Ajax加载插件js -->
<!-- <script src="__AJSPLUGINS__/plugins/pace/pace.min.js"></script> -->
<script>
//封装后的弹窗控件方法
function layerDialog(title,url,width,height,shadeClose) {/*title:dialog的标题,url:dialog的路径,width:dialog的宽度,height:dialog的高度,shadeClose:布尔值，点击遮罩层是否关闭当前窗口*/
	if(!IsPC()) {
		width = "80%";
		height = "95%";
	}
	layer.open({
		type: 2,
	    shade: [0.5, '#000'],
	    fix: true,
	    moveOut: true,
	    moveType: 1,
	    title:[title, 'font-weight:bold; font-size:15px;'],
	    maxmin: true,
	    scrollbar: true,
	    shadeClose: shadeClose,
	    area: [width , height],
	    content: url
	});
}
//判断是否PC
function IsPC() {
    var userAgentInfo = navigator.userAgent;
    var Agents = ["Android", "iPhone",
                "SymbianOS", "Windows Phone",
                "iPad", "iPod"];
    var flag = true;
    for (var v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
            flag = false;
            break;
        }
    }
    return flag;
}

//修改密码
function modifyPwd() {
	layerDialog("修改密码",'<{:U('Index/editPwd')}>',"80%","340px",true);
}

$(".ibox-search-box").find(":text").keyup(function() {
	enableTitle($(this));
})
$(".ibox-search-box").find(":text").blur(function() {
	enableTitle($(this));
})
$(".ibox-search-box").find(":input").each(function() {
	enableTitle($(this));
})

//显示隐藏title
function enableTitle(t) {
	if($(t).val() == "") {
		$(t).parents(".infont").find("span").remove();
		$(t).parents(".infont").find("span").fadeOut(200);
	}else{
		if($(t).parents(".infont").find("span").length == 0) {
			$(t).parents(".infont").prepend('<span></span>');
		}
		$(t).parents(".infont").find("span").html($(t).attr("placeholder"));
		$(t).parents(".infont").find("span").fadeIn(200);
	}
}

</script>
